home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / Oracle-HOWTO < prev    next >
Text File  |  1997-03-18  |  32KB  |  855 lines

  1.   Oracle Database HOWTO
  2.   Paul Haigh, paul@nailed.demon.co.uk
  3.   v1.0, 10 March 1998
  4.  
  5.   A guide to installing and configuring the Oracle Database Server on a
  6.   Linux system
  7.  
  8.   1.  Introduction
  9.  
  10.   1.1.  Version History
  11.  
  12.   ╖  v0.1 - 21 Feb 1998 - Paul Haigh - Original Version
  13.  
  14.   ╖  v0.2 - 01 Mar 1998 - Paul Haigh - Comments From Proofreaders Added
  15.  
  16.   ╖  v1.0 - 10 Mar 1998 - Paul Haigh - Released to LDP
  17.  
  18.   1.2.  Copyright
  19.  
  20.   The Oracle Database HOWTO copyright (c) 1998, Paul Haigh.
  21.  
  22.   Like all Linux HOWTO documents, this may be reproduced and distributed
  23.   in whole or in part, in any medium, physical or electronic, so long as
  24.   this copyright notice is retained on all copies.
  25.  
  26.   Commercial redistribution is allowed and encouraged; however the
  27.   author would like to be notified of such distributions. You may
  28.   translate this HOWTO into any language whatsoever provided that you
  29.   leave this copyright statement and disclaimer intact, and that you
  30.   append a notice stating who translated the document.
  31.  
  32.   1.3.  Disclaimer
  33.  
  34.   While I have tried to include the most correct and up to date
  35.   information available to me, I cannot guarantee that usage of
  36.   information in this document does not result in loss of data or
  37.   equipment. I provide NO WARRANTY about the information in the HOWTO
  38.   and I cannot be made liable for any consequences resulting from using
  39.   the information in this HOWTO.
  40.  
  41.   1.4.  Aim of the HOWTO
  42.  
  43.   In this HOWTO I will attempt to cover installation and basic admin of
  44.   an Oracle database running on a Linux machine.  In particular I will
  45.   cover Oracle server installation, SQL*Net configuration and client
  46.   configuration.
  47.  
  48.   This document is not an in depth tutorial on using or administering an
  49.   Oracle database, if that is what you are looking for there are great
  50.   books on those subjects published by O'Reilly and others.
  51.  
  52.   I am also not going to cover the development of Oracle programs under
  53.   UNIX.  If this is absolutley necessary to you then I would recommend
  54.   that you purchase the SCO development system (with OpenServer 5.x)
  55.   from SCO, which I am told can be obtained for a very reasonable US
  56.   $19, from www.sco.com.
  57.  
  58.   1.5.  Requirements
  59.  
  60.   I am assuming a number of items that you will need for following the
  61.   HOWTO.
  62.  
  63.   ╖  Oracle Server CD for SCO Openserver (Version 7.3.3.0.0.)
  64.  
  65.         This must be a legal copy.  Remember that Oracle are a profit
  66.         making company and charge for their products.  If you want a
  67.         free SQL compliant database use PostgresSQL or similar.
  68.  
  69.         It is also possible to install oracle, using a 60 day evaluation
  70.         licence, from a downloadable tar file from the Oracle web site.
  71.         I have not personally tried this and it is completely
  72.         unverified.
  73.  
  74.   ╖  A Linux Server
  75.  
  76.         You wouldn't be reading this without one...would you?
  77.  
  78.   ╖  Kernel 2.0.30+
  79.  
  80.         I cannot guarantee that these instructions will be accurate for
  81.         any other Kernel.  (Not that I am guaranteeing it for 2.0.30
  82.         either...).
  83.  
  84.   ╖  iBCS
  85.  
  86.         It is very important to have this installed and working with the
  87.         latest possible version for your platform.  (I am using
  88.         iBCS-2.0-10.i386.rpm from Redhat Linux).
  89.  
  90.   ╖  Lots of disc space
  91.  
  92.         600 Mb+ is a reasonable amount.  It is possible to install with
  93.         less but you need to make some sacrifices, and I never like
  94.         starting with those.  However, I will attempt to point out areas
  95.         in which space can be freed up.
  96.  
  97.   ╖  32Mb+ Ram
  98.  
  99.         I know that this sounds like a lot, especially in Linux terms,
  100.         but remember that Oracle is a complex piece of software.  You
  101.         wouldn't have the same reservations on SCO!
  102.  
  103.         I am not saying that Oracle doesn't work with less, just that it
  104.         is less than Oracle recommend and I wouldn't suggest it.
  105.  
  106.   ╖  Licenses from Oracle
  107.  
  108.         I know that I have already mentioned this but I want to be clear
  109.         that this is important.  Using software from Oracle without a
  110.         license is illegal.
  111.  
  112.   1.6.  Future Improvements
  113.  
  114.   Here are the areas of the Oracle server that are not covered in this
  115.   HOWTO.  However, time permitting, I will attempt to get them into
  116.   later versions of the HOWTO.
  117.  
  118.   ╖  Development of Oracle Pro* programs using the Oracle libraries.
  119.  
  120.   ╖  Installing different versions of Oracle server.
  121.  
  122.   ╖  Installing Oracle Web Server.
  123.  
  124.   ╖  How to relink the Oracle Kernel.
  125.  
  126.   2.  Installing the Oracle Software
  127.  
  128.   2.1.  Server Preparation
  129.  
  130.   2.1.1.  Creating an Oracle User
  131.  
  132.   Unsurprisingly we require a user to hold the Oracle database.  Since
  133.   we have no desire to relink the Oracle kernel (more about that later)
  134.   we have to accept the Oracle defaults for user name and group name.
  135.   This includes the user ORACLE and the group DBA.
  136.  
  137.   1. Login as Root
  138.  
  139.   2. Create the oracle user and the group dba.
  140.  
  141.        ______________________________________________________________________
  142.        $ groupadd dba
  143.        $ useradd  oracle
  144.        ______________________________________________________________________
  145.  
  146.   3. Ensure a home directory is created for the user oracle.
  147.  
  148.        ______________________________________________________________________
  149.        $ mkdir /home/oracle
  150.        $ mkdir /home/oracle/7.3.3.0.0 (Version of Oracle)
  151.        $ chown -R oracle.dba /home/oracle
  152.        ______________________________________________________________________
  153.  
  154.   2.2.  Installing from CDROM
  155.  
  156.   Unfortunately the Oracle Installer on the SCO disc will not work.  A
  157.   variety of problems can be experienced, from core dumps to hangs.  As
  158.   a result we need to copy the files from the CDROM manually and
  159.   uncompress them:
  160.  
  161.   (Ensure the CDROM is mounted on the system).
  162.  
  163.   1. Log on as Oracle
  164.  
  165.   2. Change directory to /home/oracle/7.3.3.0.0.
  166.  
  167.   3. Copy all install files from CDROM
  168.  
  169.        ______________________________________________________________________
  170.        $ cp -a /mnt/cdrom/* .
  171.        ______________________________________________________________________
  172.  
  173.   4. Un-compress all Oracle files on CDROM.
  174.  
  175.        ______________________________________________________________________
  176.        $ find . -name *_ -exec ~/7.3.3.0.0/orainst/oiuncomp {} \;
  177.        ______________________________________________________________________
  178.  
  179.   2.3.  Post Installation Tasks
  180.  
  181.   2.3.1.  Tasks for Root
  182.  
  183.   Add the following lines to /etc/profile or add to the .profile for
  184.   each user who is going to use Oracle.
  185.  
  186.        ______________________________________________________________________
  187.        # Oracle Specific
  188.        ORACLE_HOME=/home/oracle/7.3.3.0.0
  189.        ORACLE_SID=orcl
  190.        ORACLE_TERM=vt100
  191.        export ORACLE_HOME ORACLE_SID ORACLE_TERM
  192.  
  193.        # Alter path for Oracle
  194.        PATH="$PATH:$ORACLE_HOME/bin"
  195.        ______________________________________________________________________
  196.  
  197.   We also need to change the owner and permissions of the Oracle ulimit
  198.   increase utility.
  199.  
  200.        ______________________________________________________________________
  201.        $ chown root.root $ORACLE_HOME/bin/osh
  202.        $ chmod u+s $ORACLE_HOME/bin/osh
  203.        ______________________________________________________________________
  204.  
  205.   2.3.2.  Tasks for Oracle
  206.  
  207.   Change permissions for the Oracle files to ensure correct operation.
  208.  
  209.        ______________________________________________________________________
  210.        $ chmod +x $ORACLE_HOME/bin/*
  211.        $ chmod u+s $ORACLE_HOME/bin/oracle
  212.        ______________________________________________________________________
  213.  
  214.   Oracle tools require the messages to be in the
  215.   $ORACLE_HOME/tool_name/mesg directory.  So, move the msb files from
  216.   the msg_ship directories to the mesg directories.
  217.  
  218.        ______________________________________________________________________
  219.        $ mv $ORACLE_HOME/plsql/mesg/mesg_ship/* $ORACLE_HOME/plsql/mesg/.
  220.        $ mv $ORACLE_HOME/rdbms/mesg/mesg_ship/* $ORACLE_HOME/rdbms/mesg/.
  221.        $ mv $ORACLE_HOME/svrmgr/mesg/mesg_ship/* $ORACLE_HOME/svrmgr/mesg/.
  222.        ______________________________________________________________________
  223.  
  224.   Create the following directories if they do not exist:
  225.  
  226.        ______________________________________________________________________
  227.        $ mkdir $ORACLE_HOME/rdbms/log
  228.        $ mkdir $ORACLE_HOME/rdbms/audit
  229.        $ mkdir $ORACLE_HOME/network/log
  230.        ______________________________________________________________________
  231.  
  232.   2.3.3.  Things you can remove
  233.  
  234.   The following directories can safely be removed:
  235.  
  236.   ╖  $ORACLE_HOME/guicommon2/
  237.  
  238.   ╖  $ORACLE_HOME/ctx/
  239.  
  240.   ╖  $ORACLE_HOME/md/
  241.  
  242.   ╖  $ORACLE_HOME/mlx/
  243.  
  244.   ╖  $ORACLE_HOME/precomp/
  245.  
  246.   ╖  $ORACLE_HOME/slax/
  247.  
  248.   3.  Creating a Database
  249.  
  250.   Now the Oracle server is installed we need to create a database to
  251.   test the installation.
  252.  
  253.   3.1.  Create the Initialisation File
  254.  
  255.   Copy the $ORACLE_HOME/dbs/init.ora to $ORACLE_HOME/dbs/initorcl.ora:
  256.  
  257.   ______________________________________________________________________
  258.   $ cd $ORACLE_HOME/dbs
  259.   $ cp init.ora initorcl.ora
  260.   ______________________________________________________________________
  261.  
  262.   Modify it by adding the following lines:
  263.  
  264.        ______________________________________________________________________
  265.        db_name = orcl
  266.        COMPATIBLE=7.3.3.0.0
  267.        ______________________________________________________________________
  268.  
  269.   3.2.  Creating the Database Install Script
  270.  
  271.   Create a script file called makedb.sql in the $ORACLE_HOME/dbs
  272.   directory:
  273.  
  274.        ______________________________________________________________________
  275.        connect internal
  276.        startup nomount
  277.        set echo on
  278.        spool makedb.log
  279.        create database orcl
  280.                maxinstances 1
  281.                maxlogfiles  8
  282.                datafile '$ORACLE_HOME/dbs/orcl_syst_01.dbf' size 40M reuse
  283.                logfile
  284.                        '$ORACLE_HOME/dbs/orcl_redo_01.dbf' size 1M reuse,
  285.                        '$ORACLE_HOME/dbs/orcl_redo_02.dbf' size 1M reuse,
  286.                        '$ORACLE_HOME/dbs/orcl_redo_03.dbf' size 1M reuse;
  287.        @$ORACLE_HOME/rdbms/admin/catalog.sql
  288.        create tablespace rollback
  289.                datafile '$ORACLE_HOME/dbs/orcl_roll_01.dbf' size 8.5M reuse;
  290.        create tablespace temporary
  291.                datafile '$ORACLE_HOME/dbs/orcl_temp_01.dbf' size 5M reuse
  292.                temporary;
  293.        create tablespace users
  294.                datafile '$ORACLE_HOME/dbs/orcl_user_01.dbf' size 10M reuse;
  295.        create rollback segment r1 tablespace rollback
  296.                storage ( optimal 5M );
  297.        alter rollback segment r1 online;
  298.        connect system/manager
  299.        @$ORACLE_HOME/rdbms/admin/catdbsyn.sql
  300.        connect internal
  301.        @$ORACLE_HOME/rdbms/admin/catproc.sql
  302.        connect system/manager
  303.        @$ORACLE_HOME/sqlplus/admin/pupbld.sql
  304.        spool off
  305.        exit
  306.        ______________________________________________________________________
  307.  
  308.   3.3.  Running the Database Installation Script
  309.  
  310.   Start svrmgrl and run the script:
  311.  
  312.        ______________________________________________________________________
  313.        $ cd $ORACLE_HOME/dbs
  314.        $ svrmgrl
  315.  
  316.        Oracle Server Manager Release 2.3.3.0.0 - Production
  317.  
  318.        Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
  319.  
  320.        Oracle7 Server Release 7.3.3.0.0 - Production Release
  321.        PL/SQL Release 2.3.3.0.0 - Production
  322.  
  323.        SVRMGR> connect internal
  324.        Connected.
  325.        SVRMGR> startup nomount
  326.        ORACLE instance started.
  327.        Total System Global Area       4313312 bytes
  328.        Fixed Size                       41876 bytes
  329.        Variable Size                  4140364 bytes
  330.        Database Buffers                122880 bytes
  331.        Redo Buffers                      8192 bytes
  332.        SVRMGR> @makedb
  333.        <loads of messages>
  334.        SVRMGR> exit
  335.        Server Manager complete.
  336.        ______________________________________________________________________
  337.  
  338.   3.4.  Starting the Database
  339.  
  340.   Firstly, we need to bring up the database by hand (we will automate
  341.   this later on).  To startup an Oracle database we need to issue the
  342.   startup command when connected internally:
  343.  
  344.        ______________________________________________________________________
  345.        $ svrmgrl
  346.  
  347.        Oracle Server Manager Release 2.3.3.0.0 - Production
  348.  
  349.        Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
  350.  
  351.        Oracle7 Server Release 7.3.3.0.0 - Production Release
  352.        PL/SQL Release 2.3.3.0.0 - Production
  353.  
  354.        SVRMGR> connect internal
  355.        Connected.
  356.        SVRMGR> startup
  357.        ORACLE instance started.
  358.        Total System Global Area       4313316 bytes
  359.        Fixed Size                       41876 bytes
  360.        Variable Size                  4140368 bytes
  361.        Database Buffers                122880 bytes
  362.        Redo Buffers                      8192 bytes
  363.        Database mounted.
  364.        Database opened.
  365.        SVRMGR> exit
  366.        Server Manager complete.
  367.        ______________________________________________________________________
  368.  
  369.   3.5.  Stopping the Database
  370.  
  371.   It is worth mentioning here that restarting a Linux server without
  372.   shutting down the Oracle database first there is a high risk of
  373.   corrupting the database.
  374.  
  375.   So, before we issue the Linux shutdown command it is wise to bring
  376.   down the database:
  377.  
  378.        ______________________________________________________________________
  379.        $ svrmgrl
  380.  
  381.        Oracle Server Manager Release 2.3.3.0.0 - Production
  382.  
  383.        Copyright (c) Oracle Corporation 1994, 1995. All rights reserved.
  384.  
  385.        Oracle7 Server Release 7.3.3.0.0 - Production Release
  386.        PL/SQL Release 2.3.3.0.0 - Production
  387.  
  388.        SVRMGR> connect internal
  389.        Connected.
  390.        SVRMGR> shutdown
  391.        Database closed.
  392.        Database dismounted.
  393.        ORACLE instance shut down.
  394.        SVRMGR> exit
  395.        Server Manager complete.
  396.        ______________________________________________________________________
  397.  
  398.   3.6.  Create a Default User
  399.  
  400.   The database, as created, has a two special users which are
  401.   automatically created.  These are:
  402.  
  403.        ______________________________________________________________________
  404.        Username                Password
  405.  
  406.        SYSTEM                  MANAGER
  407.        SYS                     change_on_install
  408.        ______________________________________________________________________
  409.  
  410.   These users are typically used to hold the standard data dictionary
  411.   information for the database.  It is a good idea to change the
  412.   passwords from the defaults as soon as possible.
  413.  
  414.   This can be achieved by:
  415.  
  416.   ______________________________________________________________________
  417.   sqlplus system/manager
  418.  
  419.   SQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998
  420.  
  421.   Copyright (c) Oracle Corporation 1979, 1996.  All rights reserved.
  422.  
  423.   Connected to:
  424.   Oracle7 Server Release 7.3.3.0.0 - Production Release
  425.  
  426.   SQL> alter user system identified by <newpassword>;
  427.  
  428.   User altered.
  429.  
  430.   SQL> alter user sys identified by <newpassword>;
  431.  
  432.   User altered.
  433.  
  434.   SQL> exit;
  435.   Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production Release
  436.   PL/SQL Release 2.3.3.0.0 - Production
  437.   ______________________________________________________________________
  438.  
  439.   Since the user system/manager is similar to using root on a UNIX
  440.   machine, we need to create a user with less ability to cause damage.
  441.   (remember to bring up the database before attempting to create a user)
  442.  
  443.   Connect to SQL*Plus and create a user:
  444.  
  445.        ______________________________________________________________________
  446.        $ sqlplus system/manager
  447.  
  448.        SQL*Plus: Release 3.3.3.0.0 - Production on Sat Feb 21 12:43:33 1998
  449.  
  450.        Copyright (c) Oracle Corporation 1979, 1996.  All rights reserved.
  451.  
  452.        Connected to:
  453.        Oracle7 Server Release 7.3.3.0.0 - Production Release
  454.        PL/SQL Release 2.3.3.0.0 - Production
  455.  
  456.        SQL> create user <user> identified by <psw>
  457.          2  default tablespace users
  458.          3  temporary tablespace temp;
  459.  
  460.        User created.
  461.  
  462.        SQL> grant connect, resource to <user>
  463.  
  464.        Grant succeeded.
  465.  
  466.        SQL> exit
  467.        Disconnected from Oracle7 Server Release 7.3.3.0.0 - Production Release
  468.        PL/SQL Release 2.3.3.0.0 - Production
  469.        ______________________________________________________________________
  470.  
  471.   Now that you have a new user on the system you can play with the new
  472.   system.  To login to the Oracle database:
  473.  
  474.        ______________________________________________________________________
  475.        $ sqlplus <user>/<password>
  476.        ______________________________________________________________________
  477.  
  478.   If this completes with no error messages then you have a working
  479.   Oracle database.  If you never want to connect to this database from
  480.   anywhere but this server then the job is complete, enjoy!
  481.  
  482.   If, however, like most people you want to configure the networking
  483.   software so that you can connect from other machines, keep on reading.
  484.  
  485.   4.  Configuring SQL*Net on the Server
  486.  
  487.   All of these files configure the Oracle networking software (SQL*Net,
  488.   aka Net8 for Oracle8).  These files should all be created on the
  489.   server in the $ORACLE_HOME/network/admin directory.
  490.  
  491.   4.1.  tnsnames.ora
  492.  
  493.   The TNSNAMES.ORA file identifies services available from the machine.
  494.   On our instance here we will describe all databases that the server
  495.   has mounted.  For each database instance on your server add a section
  496.   like below:
  497.  
  498.        ______________________________________________________________________
  499.        orcl.world =
  500.          (DESCRIPTION =
  501.            (ADDRESS_LIST =
  502.                (ADDRESS =
  503.                  (COMMUNITY = tcp.world)
  504.                  (PROTOCOL = TCP)
  505.                  (Host = <INSERT HOST NAME OF SERVER HERE> )
  506.                  (Port = 1521)
  507.                )
  508.                (ADDRESS =
  509.                  (COMMUNITY = tcp.world)
  510.                  (PROTOCOL = TCP)
  511.                  (Host = <INSERT HOST NAME OF SERVER HERE> )
  512.                  (Port = 1526)
  513.                )
  514.            )
  515.            (CONNECT_DATA = (SID = ORCL)
  516.            )
  517.          )
  518.        ______________________________________________________________________
  519.  
  520.   4.2.  listener.ora
  521.  
  522.   The listener.ora file contains the descriptions of the services that
  523.   other machines are allowed to connect to and any configuration that is
  524.   required for the server listener.
  525.  
  526.   It contains sections for the listener name, listener address,
  527.   databases served by the listener and configuration parameters.
  528.  
  529.   Here is an example:
  530.  
  531.        ______________________________________________________________________
  532.        # Name of listener and addresses to listen on
  533.        LISTENER =
  534.                ( ADDRESS_LIST =
  535.                        (ADDRESS =
  536.                                (PROTOCOL=tcp)
  537.                                (HOST=<INSERT HOST>)
  538.                                (PORT=1521)
  539.                                (COMMUNITY=UK_SUP_TCPIP)
  540.                        )
  541.                        (ADDRESS =
  542.                                (PROTOCOL=ipc)
  543.                                (KEY=700)
  544.                                (COMMUNITY=UK_SUP_TCPIP)
  545.                        )
  546.                )
  547.  
  548.        # List of services served by this listener
  549.        SID_LIST_LISTENER=
  550.                (SID_LIST=
  551.                        (SID_DESC=
  552.                                (SID_NAME=orcl)
  553.                                (ORACLE_HOME=/home/oracle/7.3.3.0.0)
  554.                        )
  555.                )
  556.  
  557.        # Start of configuration parameters.
  558.        TRACE_LEVEL_LISTENER=OFF
  559.        TRACE_FILE_LISTENER = "listener"
  560.        LOG_FILE_LISTENER = "listener"
  561.        CONNECT_TIMEOUT_LISTENER = 10
  562.        STOP_LISTENER = YES
  563.        DBA_GROUP = dba
  564.        ______________________________________________________________________
  565.  
  566.   4.3.  sqlnet.ora
  567.  
  568.   The sqlnet.ora file contains configuration for the particular node of
  569.   the network.  This is independent of the number of databases or the
  570.   number of listeners.  The most important thing in this file is the
  571.   Dead Connection Timeout configuration variable.
  572.  
  573.   Dead connection timeout checks every incoming process to a database
  574.   instance and ensures that the client end of it is still responding.
  575.   If the client (of whatever type) is not responding then the Oracle
  576.   server shadow process is killed.
  577.  
  578.   This is very useful if you have many clients accessing a database,
  579.   especially during a developmental phase when those clients are more
  580.   likely to be failing to exit cleanly from the Oracle database.
  581.  
  582.   Below is a copy of my own sqlnet.ora file for you to puruse:
  583.  
  584.   ______________________________________________________________________
  585.   TRACE_LEVEL_CLIENT = OFF
  586.   sqlnet.expire_time = 30         # The number of seconds between client checks.
  587.   names.default_domain = world
  588.   name.default_zone = world
  589.   ______________________________________________________________________
  590.  
  591.   4.4.  Starting and Stopping the Listeners
  592.  
  593.   Now that the configuration of the listeners and SQL*Net is complete we
  594.   can attempt to connect to the database using the networking software.
  595.   (Before we were using direct links to the database, whereas here we
  596.   are simulating a connection from a remote client machine).
  597.  
  598.   To start the listener using the above configuration:
  599.  
  600.        ______________________________________________________________________
  601.        $ lsnrctl
  602.  
  603.        LSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:38:25
  604.  
  605.        Copyright (c) Oracle Corporation 1994.  All rights reserved.
  606.  
  607.        Welcome to LSNRCTL, type "help" for information.
  608.  
  609.        LSNRCTL> start
  610.        Starting /home/oracle/7.3.3.0.0/bin/tnslsnr: please wait...
  611.  
  612.        TNSLSNR for SCO System V/386: Version 2.3.3.0.0 - Production
  613.        System parameter file is /home/oracle/7.3.3.0.0/network/admin/listener.ora
  614.        Log messages written to /home/oracle/7.3.3.0.0/network/log/listener.log
  615.        Listening on: (ADDRESS=(PROTOCOL=tcp)(DEV=6)(HOST=192.168.1.1)(PORT=1521))
  616.        Listening on: (ADDRESS=(PROTOCOL=ipc)(DEV=10)(KEY=700))
  617.  
  618.        Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)(COMMUNITY=UK_SUP_TCPIP))
  619.        STATUS of the LISTENER
  620.        ------------------------
  621.        Alias                     LISTENER
  622.        Version                   TNSLSNR for SCO System V/386: Version 2.3.3.0.0 - Production
  623.        Start Date                23-FEB-98 20:38:50
  624.        Uptime                    0 days 0 hr. 0 min. 0 sec
  625.        Trace Level               off
  626.        Security                  OFF
  627.        SNMP                      ON
  628.        Listener Parameter File   /home/oracle/7.3.3.0.0/network/admin/listener.ora
  629.        Listener Log File         /home/oracle/7.3.3.0.0/network/log/listener.log
  630.        Services Summary...
  631.          orcl          has 1 service handler(s)
  632.        The command completed successfully
  633.        LSNRCTL> exit
  634.        ______________________________________________________________________
  635.  
  636.   To stop the listeners:
  637.  
  638.   ______________________________________________________________________
  639.   $ lsnrctl
  640.  
  641.   LSNRCTL for SCO System V/386: Version 2.3.3.0.0 - Production on 23-FEB-98 20:43:20
  642.  
  643.   Copyright (c) Oracle Corporation 1994.  All rights reserved.
  644.  
  645.   Welcome to LSNRCTL, type "help" for information.
  646.  
  647.   LSNRCTL> stop
  648.   Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=magic.com)(PORT=1521)(COMMUNITY=UK_SUP_TCPIP))
  649.   The command completed successfully
  650.   LSNRCTL> exit
  651.   ______________________________________________________________________
  652.  
  653.   If you have a DNS setup which doesn't return the IP address for the
  654.   hostname specified then starting and stopping the listener can take
  655.   some time (2-3 mins. dependant on the DNS timeout variable).  If this
  656.   is the case, don't worry, be patient.
  657.  
  658.   5.  Client Configuration
  659.  
  660.   5.1.  Windows Clients
  661.  
  662.   SQL*Net configuration on the PC using newer versions of the Oracle
  663.   Client Software is very easy.  The best (and easiest) way of achiving
  664.   a fully working client installation is to use the SQL*Net Easy
  665.   Configuration tool supplied by Oracle.
  666.  
  667.   This toolhas a wizard type interface to take you through the
  668.   installation of the tnsnames.ora and sqlnet.ora files.
  669.  
  670.   Select "Add Database Alias" and enter a name for the alias when
  671.   prompted.  This alias is the name you will refer to the database
  672.   instance as, and as such should be the same as the instance name (orcl
  673.   in this case).
  674.  
  675.   Select TCP/IP as the protocol, and when prompted the hostname of the
  676.   machine hosting the database and the instance name of the database.
  677.  
  678.   That's it.
  679.  
  680.   However, if you do not have the SQL*Net Easy Configuration Tool then
  681.   don't worry.  You can simply create the tnsnames.ora and the
  682.   sqlnet.ora files in the $ORACLE_HOME/network/admin directory on the
  683.   client exactly as they are on the server.  This will provide an alias
  684.   the same as on the server (always a good idea anyway).
  685.  
  686.   5.2.  Unix Clients
  687.  
  688.   UNIX clients are not very different that windows clients.  If you have
  689.   the Network Manager from Oracle then user that in the same way as
  690.   above, if not then you can, again, just use the same configuration
  691.   files as the server in the $ORACLE_HOME/network/admin directory.
  692.  
  693.   6.  Automatic Startup and Shutdown
  694.  
  695.   6.1.  dbstart & dbstop
  696.  
  697.   The automatic startup and shutdown of the Oracle database can be
  698.   achieved (in 7.3.3.0.0) with the files dbstart and dbshut both
  699.   provided by Oracle.  These files rely on the existance of the file
  700.   /etc/oratab to work (although by altering the dbshut and dbstart files
  701.   this can be moved).
  702.  
  703.   The format of the /etc/oratab file is as follows:
  704.  
  705.        ______________________________________________________________________
  706.        SID:ORACLE_HOME:AUTO
  707.        ______________________________________________________________________
  708.  
  709.   An example:
  710.  
  711.        ______________________________________________________________________
  712.        orcl:/home/oracle/7.3.3.0.0:Y
  713.        leaveup:/home/oracle/7.3.2.1.0:N
  714.        ______________________________________________________________________
  715.  
  716.   6.2.  init.d & rc.d
  717.  
  718.   To start and stop the database when the machine comes up and goes down
  719.   by modifying the startup routines for the Linux machine.  This is
  720.   quite easy, although I should point out here that this may change
  721.   depending on which flavour of Linux (slackware, debian, redhat, etc).
  722.   I will show examples which work for Redhat Linux 5.0.  To modify these
  723.   for your own flavour of Linux, please see your Linux documentation
  724.   sets.  (Although it should hold true for any Sys V type UNIX).
  725.  
  726.   Firstly, we need to create the script which will run dbshut and
  727.   dbstart in the /etc/rc.d/init.d directory.  Create the following file
  728.   as /etc/rc.d/init.d/oracle:
  729.  
  730.   ______________________________________________________________________
  731.   #!/bin/sh
  732.   #
  733.   # /etc/rc.d/init.d/oracle
  734.   # Description: Starts and stops the Oracle database and listeners
  735.   # See how we were called.
  736.   case "$1" in
  737.     start)
  738.           echo -n "Starting Oracle Databases: "
  739.           echo "----------------------------------------------------" >> /var/log/oracle
  740.           date +"! %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle
  741.           echo "----------------------------------------------------" >> /var/log/oracle
  742.           su - oracle -c dbstart >> /var/log/oracle
  743.           echo "Done."
  744.           echo -n "Starting Oracle Listeners: "
  745.           su - oracle -c "lsnrctl start" >> /var/log/oracle
  746.           echo "Done."
  747.           echo ""
  748.           echo "----------------------------------------------------" >> /var/log/oracle
  749.           date +"! %T %a %D : Finished." >> /var/log/oracle
  750.           echo "----------------------------------------------------" >> /var/log/oracle
  751.           touch /var/lock/subsys/oracle
  752.           ;;
  753.     stop)
  754.           echo -n "Shutting Down Oracle Listeners: "
  755.           echo "----------------------------------------------------" >> /var/log/oracle
  756.           date +"! %T %a %D : Shutting Down Oracle Databases as part of system down." >> /var/log/oracle
  757.           echo "----------------------------------------------------" >> /var/log/oracle
  758.           su - oracle -c "lsnrctl stop" >> /var/log/oracle
  759.           echo "Done."
  760.           rm -f /var/lock/subsys/oracle
  761.           echo -n "Shutting Down Oracle Databases: "
  762.           su - oracle -c dbshut >> /var/log/oracle
  763.           echo "Done."
  764.           echo ""
  765.           echo "----------------------------------------------------" >> /var/log/oracle
  766.           date +"! %T %a %D : Finished." >> /var/log/oracle
  767.           echo "----------------------------------------------------" >> /var/log/oracle
  768.           ;;
  769.     restart)
  770.           echo -n "Restarting Oracle Databases: "
  771.           echo "----------------------------------------------------" >> /var/log/oracle
  772.           date +"! %T %a %D : Restarting Oracle Databases as part of system up." >> /var/log/oracle
  773.           echo "----------------------------------------------------" >> /var/log/oracle
  774.           su - oracle -c dbstop >> /var/log/oracle
  775.           su - oracle -c dbstart >> /var/log/oracle
  776.           echo "Done."
  777.           echo -n "Restarting Oracle Listeners: "
  778.           su - oracle -c "lsnrctl stop" >> /var/log/oracle
  779.           su - oracle -c "lsnrctl start" >> /var/log/oracle
  780.           echo "Done."
  781.           echo ""
  782.           echo "----------------------------------------------------" >> /var/log/oracle
  783.           date +"! %T %a %D : Finished." >> /var/log/oracle
  784.           echo "----------------------------------------------------" >> /var/log/oracle
  785.           touch /var/lock/subsys/oracle
  786.           ;;
  787.     *)
  788.           echo "Usage: oracle {start|stop|restart}"
  789.           exit 1
  790.   esac
  791.   ______________________________________________________________________
  792.  
  793.   It is worth checking that this file actually correctly stops and
  794.   starts the databases for your system.  Check the log file,
  795.   /var/log/oracle for error messages.
  796.  
  797.   Once this script is working we need to create start and kill symbolic
  798.   links in the appropriate runlevel directories /etc/rc.d/rcX.d.
  799.  
  800.   The following commands will ensure that the databases will come up in
  801.   runlevels 2,3 and 4:
  802.  
  803.        ______________________________________________________________________
  804.        $ ln -s ../init.d/oracle /etc/rc.d/rc2.d/S99oracle
  805.        $ ln -s ../init.d/oracle /etc/rc.d/rc3.d/S99oracle
  806.        $ ln -s ../init.d/oracle /etc/rc.d/rc4.d/S99oracle
  807.        ______________________________________________________________________
  808.  
  809.   To stop the databases on reboot or restart we need the following
  810.   links:
  811.  
  812.        ______________________________________________________________________
  813.        $ ln -s ../init.d/oracle /etc/rc.d/rc0.d/K01oracle          # Halting
  814.        $ ln -s ../init.d/oracle /etc/rc.d/rc6.d/K01oracle          # Rebooting
  815.        ______________________________________________________________________
  816.  
  817.   7.  Other Bits
  818.  
  819.   7.1.  Intelligent Agent
  820.  
  821.   If you have a need for the Oracle Intelligent Agent, I found that you
  822.   can run it without any configuration changes.  To start the IA try:
  823.  
  824.        ______________________________________________________________________
  825.        $ lsnrctl dbsnmp_start
  826.        ______________________________________________________________________
  827.  
  828.   To stop the IA try:
  829.  
  830.        ______________________________________________________________________
  831.        $ lsnrctl dbsnmp_stop
  832.        ______________________________________________________________________
  833.  
  834.   There do not appear to be any messages indicating a sucessful or
  835.   otherwise start or stop of the intelligent agent.  However, the IA
  836.   responded to Enterprise manager on the client side so I can only
  837.   assume that it is working.
  838.  
  839.   8.  Credits
  840.  
  841.   This document was based on a document written by Bob Withers,
  842.   bwit@pobox.com.  Additional information taken from documents written
  843.   by Georg Rehfeld, rehfeld@wmd.de and David Mansfield,
  844.   david@claremont.com.
  845.  
  846.   Additional proof reading done by Bob Withers, Mark Watling,
  847.   mwatling@mjw-ltd.demon.co.uk, Peter Sodhi, petersodhi@unn.unisys.com
  848.   and Greg Hankins, greg.hankins@cc.gatech.edu.
  849.  
  850.   My thanks go to the tremendous support from all the people involved in
  851.   this document and the research that has gone into it.  Particular
  852.   thanks to Bob Withers and Mark Watling for the additional comments and
  853.   help they have provided.
  854.  
  855.